<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="match" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{matchHome.managed ? 'Edit' : 'Add'} Match</f:facet>






            <s:decorate id="createDateField" template="layout/edit.xhtml">
                <ui:define name="label">Create date</ui:define>
                <rich:calendar id="createDate"
                       required="true"
                          value="#{matchHome.instance.createDate}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>


            <s:decorate id="seenDateField" template="layout/edit.xhtml">
                <ui:define name="label">Seen date</ui:define>
                <rich:calendar id="seenDate"
                          value="#{matchHome.instance.seenDate}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>


            <s:decorate id="rejectDateField" template="layout/edit.xhtml">
                <ui:define name="label">Reject date</ui:define>
                <rich:calendar id="rejectDate"
                          value="#{matchHome.instance.rejectDate}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{matchHome.persist}"
                       disabled="#{!matchHome.wired}"
                       rendered="#{!matchHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{matchHome.update}"
                       rendered="#{matchHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{matchHome.remove}"
                      immediate="true"
                       rendered="#{matchHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Match.xhtml"
                rendered="#{matchHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty matchFrom ? 'MatchList' : matchFrom}.xhtml"
                rendered="#{!matchHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Travel *" labelClass="required">
    <div class="association" id="travelParent">

        <h:outputText value="There is no travel associated with this match."
                   rendered="#{matchHome.instance.travel == null}"/>

        <rich:dataTable var="_travel"
                   value="#{matchHome.instance.travel}"
                rendered="#{matchHome.instance.travel != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="travelTable">
            <h:column>
                <f:facet name="header">Id travel</f:facet>
                <h:outputText value="#{_travel.idTravel}"/>
            </h:column>
            <h:column>
                <f:facet name="header">City by to city id city</f:facet>
                <h:outputText value="#{_travel.cityByToCity.idCity}"/>
            </h:column>
            <h:column>
                <f:facet name="header">State by from state id state</f:facet>
                <h:outputText value="#{_travel.stateByFromState.idState}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Country by from country id country</f:facet>
                <h:outputText value="#{_travel.countryByFromCountry.idCountry}"/>
            </h:column>
            <h:column>
                <f:facet name="header">User id user</f:facet>
                <h:outputText value="#{_travel.user.idUser}"/>
            </h:column>
            <h:column>
                <f:facet name="header">State by to state id state</f:facet>
                <h:outputText value="#{_travel.stateByToState.idState}"/>
            </h:column>
            <h:column>
                <f:facet name="header">City by from city id city</f:facet>
                <h:outputText value="#{_travel.cityByFromCity.idCity}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Country by to country id country</f:facet>
                <h:outputText value="#{_travel.countryByToCountry.idCountry}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{_travel.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">From lat</f:facet>
                <h:outputText value="#{_travel.fromLat}"/>
            </h:column>
            <h:column>
                <f:facet name="header">From lon</f:facet>
                <h:outputText value="#{_travel.fromLon}"/>
            </h:column>
            <h:column>
                <f:facet name="header">To lat</f:facet>
                <h:outputText value="#{_travel.toLat}"/>
            </h:column>
            <h:column>
                <f:facet name="header">To lon</f:facet>
                <h:outputText value="#{_travel.toLon}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Distance</f:facet>
                <h:outputText value="#{_travel.distance}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Travel state</f:facet>
                <h:outputText value="#{_travel.travelState}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Calculated rate</f:facet>
                <h:outputText value="#{_travel.calculatedRate}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Create date</f:facet>
                <h:outputText value="#{_travel.createDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Modify date</f:facet>
                <h:outputText value="#{_travel.modifyDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Delete date</f:facet>
                <h:outputText value="#{_travel.deleteDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Cron expression</f:facet>
                <h:outputText value="#{_travel.cronExpression}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Monday</f:facet>
                <h:outputText value="#{_travel.monday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Tuesday</f:facet>
                <h:outputText value="#{_travel.tuesday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Wednesday</f:facet>
                <h:outputText value="#{_travel.wednesday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Thursday</f:facet>
                <h:outputText value="#{_travel.thursday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Friday</f:facet>
                <h:outputText value="#{_travel.friday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Saturday</f:facet>
                <h:outputText value="#{_travel.saturday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Sunday</f:facet>
                <h:outputText value="#{_travel.sunday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Begin date</f:facet>
                <h:outputText value="#{_travel.beginDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">End date</f:facet>
                <h:outputText value="#{_travel.endDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Single day</f:facet>
                <h:outputText value="#{_travel.singleDay}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{matchHome.instance.travel != null ? 'changeParent' : 'selectParent'}" value="#{matchHome.instance.travel != null ? 'Change' : 'Select'} travel"
                       view="/TravelList.xhtml">
                <f:param name="from" value="MatchEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Request *" labelClass="required">
    <div class="association" id="requestParent">

        <h:outputText value="There is no request associated with this match."
                   rendered="#{matchHome.instance.request == null}"/>

        <rich:dataTable var="_request"
                   value="#{matchHome.instance.request}"
                rendered="#{matchHome.instance.request != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="requestTable">
            <h:column>
                <f:facet name="header">Id request</f:facet>
                <h:outputText value="#{_request.idRequest}"/>
            </h:column>
            <h:column>
                <f:facet name="header">City by to city id city</f:facet>
                <h:outputText value="#{_request.cityByToCity.idCity}"/>
            </h:column>
            <h:column>
                <f:facet name="header">State by from state id state</f:facet>
                <h:outputText value="#{_request.stateByFromState.idState}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Country by from country id country</f:facet>
                <h:outputText value="#{_request.countryByFromCountry.idCountry}"/>
            </h:column>
            <h:column>
                <f:facet name="header">User id user</f:facet>
                <h:outputText value="#{_request.user.idUser}"/>
            </h:column>
            <h:column>
                <f:facet name="header">State by to state id state</f:facet>
                <h:outputText value="#{_request.stateByToState.idState}"/>
            </h:column>
            <h:column>
                <f:facet name="header">City by from city id city</f:facet>
                <h:outputText value="#{_request.cityByFromCity.idCity}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Country by to country id country</f:facet>
                <h:outputText value="#{_request.countryByToCountry.idCountry}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{_request.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">From lat</f:facet>
                <h:outputText value="#{_request.fromLat}"/>
            </h:column>
            <h:column>
                <f:facet name="header">From lon</f:facet>
                <h:outputText value="#{_request.fromLon}"/>
            </h:column>
            <h:column>
                <f:facet name="header">To lat</f:facet>
                <h:outputText value="#{_request.toLat}"/>
            </h:column>
            <h:column>
                <f:facet name="header">To lon</f:facet>
                <h:outputText value="#{_request.toLon}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Distance</f:facet>
                <h:outputText value="#{_request.distance}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Begin date</f:facet>
                <h:outputText value="#{_request.beginDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">End date</f:facet>
                <h:outputText value="#{_request.endDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Single day</f:facet>
                <h:outputText value="#{_request.singleDay}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Monday</f:facet>
                <h:outputText value="#{_request.monday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Tuesday</f:facet>
                <h:outputText value="#{_request.tuesday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Wednesday</f:facet>
                <h:outputText value="#{_request.wednesday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Thursday</f:facet>
                <h:outputText value="#{_request.thursday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Friday</f:facet>
                <h:outputText value="#{_request.friday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Saturday</f:facet>
                <h:outputText value="#{_request.saturday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Sunday</f:facet>
                <h:outputText value="#{_request.sunday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Cron expression</f:facet>
                <h:outputText value="#{_request.cronExpression}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Create date</f:facet>
                <h:outputText value="#{_request.createDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Modify date</f:facet>
                <h:outputText value="#{_request.modifyDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Delete date</f:facet>
                <h:outputText value="#{_request.deleteDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{matchHome.instance.request != null ? 'changeParent' : 'selectParent'}" value="#{matchHome.instance.request != null ? 'Change' : 'Select'} request"
                       view="/RequestList.xhtml">
                <f:param name="from" value="MatchEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="User *" labelClass="required">
    <div class="association" id="userParent">

        <h:outputText value="There is no user associated with this match."
                   rendered="#{matchHome.instance.user == null}"/>

        <rich:dataTable var="_user"
                   value="#{matchHome.instance.user}"
                rendered="#{matchHome.instance.user != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="userTable">
            <h:column>
                <f:facet name="header">Id user</f:facet>
                <h:outputText value="#{_user.idUser}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Login</f:facet>
                <h:outputText value="#{_user.login}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Password</f:facet>
                <h:outputText value="#{_user.password}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{_user.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Surname</f:facet>
                <h:outputText value="#{_user.surname}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Birth date</f:facet>
                <h:outputText value="#{_user.birthDate}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Create date</f:facet>
                <h:outputText value="#{_user.createDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Modify date</f:facet>
                <h:outputText value="#{_user.modifyDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Delete date</f:facet>
                <h:outputText value="#{_user.deleteDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Type</f:facet>
                <h:outputText value="#{_user.type}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Calculated rate</f:facet>
                <h:outputText value="#{_user.calculatedRate}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Enabled</f:facet>
                <h:outputText value="#{_user.enabled}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{matchHome.instance.user != null ? 'changeParent' : 'selectParent'}" value="#{matchHome.instance.user != null ? 'Change' : 'Select'} user"
                       view="/UserList.xhtml">
                <f:param name="from" value="MatchEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
